<?php

namespace App\Console;

use App\Console\Commands\Order\WithDraw\WithDraw;
use App\Console\Commands\Statistics\Dispose;
use App\Console\Commands\Statistics\UserCount;
use App\Console\Commands\Statistics\UserAmount;
use App\Console\Commands\Statistics\GameUserData;
use App\Console\Commands\Tasks\Data\AccountLevelStatistics;
use App\Console\Commands\Statistics\Platform\Day\ManyKindsData;
use App\Console\Commands\Tasks\Data\AccountLevelStatisticsDaily;
use App\Console\Commands\Tasks\Data\GameKeepStatistics;
use App\Console\Commands\Tasks\Data\MallBuyStatistics;
use App\Console\Commands\Tasks\Data\PlatformKeepStatistics;
use App\Console\Commands\Tasks\Data\SummaryDataRefresh;

use App\Console\Commands\Tasks\Data\SyncGameKeepStat;
use App\Console\Commands\Tasks\Data\SyncKeepStat;
use App\Console\Commands\Tasks\ThreeCheck\RyCheck;
use App\Console\Commands\Tasks\ThreeCheck\ShumeiCheck;
use App\Console\Commands\Tasks\ThreeCheck\ZegoCheck;
use App\Console\Commands\TempCommand;
use App\Repositories\GameSugarStatisticsRepository;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
use PHPUnit\TextUI\Command;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
//        Commands\Tasks\Data\ComputeSummaryUser::class,
//        Commands\Tasks\Data\ComputeSummaryDailyUser::class,
//        Commands\Tasks\Data\ComputeSummaryDaily::class,
//        SummaryDataRefresh::class,
        Commands\Tasks\Data\RealTimeDataStatistics::class,
        Commands\Tasks\Data\YesterdayDataStatistics::class,
        Commands\Tasks\Data\YesterdayDataSugarStatistics::class, // 糖果昨日统计
        Commands\Export\export::class, //导出数据
        AccountLevelStatistics::class,   //每日留存
        Commands\Gift\StatusChange::class, //礼物状态修改
        Commands\Statistics\SystemSerial::class, //统计系统流水
        MallBuyStatistics::class, //个性商城购买日志
//        AccountLevelStatisticsDaily::class, //每日留存
        ZegoCheck::class, //即构校验
        RyCheck::class, //融云校验
        ShumeiCheck::class, //融云校验
//        UserCount::class, //统计用户数量
//        UserAmount::class, //统计用户金额
//        GameUserData::class, //统计游戏用户数据
        ManyKindsData::class, //平台多种数据统计
        Commands\Channel\StageDataCommand::class, //渠道分期每日数据统计
        Commands\Channel\UserDataCommand::class, //渠道用户每日数据统计
        Commands\Erm\SyncUserType::class, //同步用户类型
        Commands\Erm\StatisticAmount::class, //用户收益、消费统计
        Commands\Erm\AutoAddGray::class, //自动加灰
        Commands\Erm\AutoAddBlack::class, //自动加黑
        Commands\Erm\AutoRemoveWhite::class, //过期自动移除白名单
        WithDraw::class, //自动审核提现订单
        AccountLevelStatisticsDaily::class,
        GameKeepStatistics::class,
        PlatformKeepStatistics::class,
        SyncKeepStat::class,
        SyncGameKeepStat::class,
        Dispose::class,
        TempCommand::class

    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
//        $schedule->command('task:compute-summary-daily')->dailyAt('00:01')->appendOutputTo(storage_path('logs/summary_daily.log'));
//        $schedule->command('task:compute-summary-daily-user')->dailyAt('00:05')->appendOutputTo(storage_path('logs/summary_daily_user.log'));
//        $schedule->command('task:compute-summary-user')->dailyAt('00:08')->appendOutputTo(storage_path('logs/summary_user.log'));
//        $schedule->command('task:summary-data-refresh')->hourly()->appendOutputTo(storage_path('logs/summary_refresh.log'));

        //实时数据统计，每15分钟执行一次
        $schedule->command('task:real-time-data-statistics')
            ->everyFifteenMinutes()
            ->appendOutputTo(storage_path('logs/real-time-data-statistics.log'));
        //昨日数据统计，每天凌晨0点执行
        $schedule->command('task:yesterday-data-statistics')
            ->daily()
            ->appendOutputTo(storage_path('logs/yesterday-data-statistics.log'));
        // 昨日数据统计，每天凌晨0点执行
        $schedule->command('task:yesterday-data-sugar-statistics')
            ->everyMinute();
        //导出数据，每分钟
        $schedule->command('task:export')
            ->everyMinute()
            ->appendOutputTo(storage_path('logs/export.log'));

        // 每小时统计系统留存 及资金变更日志
        $schedule->command('task:account_check_level')->hourly();
        //礼物定时上下架
        $schedule->command('gift:status-change')
            ->withoutOverlapping()
            ->everyFiveMinutes()
            ->appendOutputTo(storage_path('logs/gift-status-change.log'));
        //数据看板-系统流水统计
        $schedule->command('system-serial')
            ->withoutOverlapping()
            ->everyTenMinutes()
            ->appendOutputTo(storage_path('logs/system-serial.log'));
        //个性商城购买日志
        $schedule->command('task:mall_buy_stat')->dailyAt('00:35');
        //每日留存
        $schedule->command('task:account_check_level_daily')->dailyAt('00:40');
        $schedule->command('task:platform_keep')->dailyAt('00:45');
        $schedule->command('task:game_keep')->dailyAt('00:50');

        //三方服务
        $schedule->command('task:ry_server_check')->everyMinute();
        $schedule->command('task:shumei_server_check')->everyMinute();
        $schedule->command('task:zgo_server_check')->everyMinute();

        //统计用户数量（注册、登录、充值等）
//        $schedule->command('user-count')
//            ->withoutOverlapping()
//            ->everyFiveMinutes()
//            ->appendOutputTo(storage_path('logs/user-count.log'));
//        //统计用户金额，充值、提现金额。。。
//        $schedule->command('user-amount')
//            ->withoutOverlapping()
//            ->everyFiveMinutes()
//            ->appendOutputTo(storage_path('logs/user-amount.log'));
//        //统计游戏活动用户数据
//        $schedule->command('game-user-data')
//            ->withoutOverlapping()
//            ->everyFiveMinutes()
//            ->appendOutputTo(storage_path('logs/game-user-data.log'));

        //平台多种数据统计（推广系统平台数据统计）
        $schedule->command('platform-day-many-kinds-data')
            ->withoutOverlapping()
            ->everyTenMinutes()
            ->appendOutputTo(storage_path('logs/platform-day-many-kinds-data.log'));

        //渠道分期每日数据统计，每10分钟执行一次
        $schedule->command('channel:stage-data')
            ->everyTenMinutes()
            ->appendOutputTo(storage_path('logs/channel-stage-data.log'));
        //渠道用户每日数据统计，每10分钟执行一次
        $schedule->command('channel:user-data')
            ->everyTenMinutes()
            ->appendOutputTo(storage_path('logs/channel-user-data.log'));

        /*预警系统*/
        //同步用户类型
        $schedule->command('task:sync_user_type')->everyMinute();

        //用户收益、消费统计
        $schedule->command('task:statistic_amount')->everyMinute();
        //自动加灰
        $schedule->command('task:auto_add_gray')->everyMinute();
        //自动审核提现订单
        $schedule->command('task:auto_check_withdraw_order')->everyThirtyMinutes();
        //自动加黑
        $schedule->command('task:auto_add_black')->everyMinute();
        //过期自动移除白名单
        $schedule->command('task:auto_remove_white')->everyMinute();


    }
}
